package ooday02;

public class Teacher extends Person {
    double salary;

    Teacher(String name, int age, String address, double salary) {
        super(name, age, address);
        this.salary = salary;
    }

//    Teacher(String name, int age, String address, double salary) {
//
//        super(name,age,address);
//        this.salary = salary;
//    }

    /**
     * 方法的重写：重新写也称覆盖
     * 只发生载父子类，必须方法同名，参数列表相同
     * 重写方法被调用是，看对象的类型-------------new谁就调用谁
     */
    //重写了方法
    void sayHi() {
        System.out.println("大家好，我叫" + name + ",今年" + age + "岁了,家住" + address + ",我一天的工资：" + salary);
    }

    void teach() {
        System.out.println(name + "老师正在教学生打游戏.....");
    }
}
